package com.ruoyi.project.check.controller;

import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.check.domian.Hoscheck;
import com.ruoyi.project.check.domian.Hosresultenety;
import com.ruoyi.project.check.service.IHosResultenetyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("project/resultenety")
public class HosResultenetyController extends BaseController {
    @Autowired
    private IHosResultenetyService hosResultenetyService;
    /**
     * 页面数据显示
     * @param
     * @return
     */
    @PreAuthorize("@ss.hasPermi('project:resultenety:list')")
    @GetMapping("/list")
    public TableDataInfo list(Hosresultenety hosresultenety){
        startPage();
        List<Hosresultenety> list = hosResultenetyService.selectHosResultenetylist(hosresultenety);
        return getDataTable(list);
    }

    /**
     *
      * @param hosresultenety
     * @return
     */
    @PreAuthorize("@ss.hasPermi('system:check:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Hosresultenety hosresultenety)
    {
        return toAjax(hosResultenetyService.insertHosResultenety(hosresultenety));
    }

    /**
     *
     * @param checkId
     * @return
     */
    @PreAuthorize("@ss.hasPermi('project:resultenety:query')")
    @GetMapping(value = "/{checkId}")
    public AjaxResult getInfo( @PathVariable("checkId") Long checkId){
        return AjaxResult.success(hosResultenetyService.selectHosResultenetyById(checkId));
    }
    /**
     *
     * @param hosresultenety
     * @return
     */
    @PreAuthorize("@ss.hasPermi('project:resultenety:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Hosresultenety hosresultenety){
        return AjaxResult.success(hosResultenetyService.updateHosResultenety(hosresultenety));
    }

    /**
     *
     * @param checkId
     * @return
     */
    @PreAuthorize("@ss.hasPermi('system:check:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{checkId}")
    public AjaxResult remove(@PathVariable Long checkId)
    {
        return toAjax(hosResultenetyService.deleteHosCheckById(checkId));
    }



}
